package com.bwie.es;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.classgraph.json.Id;
import lombok.Data;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @author 11394
 * @version 1.0
 * @description: TODO
 * @date 2024/7/10 8:47
 */
@Data
@Document(indexName = "es_acrticle",replicas = 1,shards = 1)
public class EsActicle {
    @Id
    @Field(type = FieldType.Keyword)
    private Integer id;

    @Field(type = FieldType.Integer)
    private Integer typeId;

    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String articleName;

    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date articleTime;

   @Field(type = FieldType.Text,index = false)
    private String articleUrl;

   @Field(type = FieldType.Text,analyzer = "ik_max_word")
   private String typeName;
}
